package com.java46.struts2.user.service;

import com.java46.struts2.base.exception.BusinessException;
import com.java46.struts2.user.dao.TUserDao;
import com.java46.struts2.base.entity.TUserEntity;

/**
 * @ClassName TUserService
 * @Description 用户业务逻辑
 * @Author zuxia
 * @Date 2018/7/17 10:00
 * @Vcrsion 1.0
 **/
public  class TUserService {



    /**
     * @Author xiaobo
     * @Description //用户登录
     * @Date 10:06 2018/7/17
     * @Param [uSign]
     * @return void
     */
    public static int userLogin(String uSign,String uName){
        if (uName==null||uSign==null||uSign.trim().equals("")||uName.trim().equals("")){
            throw  new BusinessException("用户数据不完整");
        }
        TUserEntity tuser=TUserDao.queryTUserUsign(uSign);
        if(tuser==null){
            TUserDao.addTUser(uSign,uName);
            tuser=TUserDao.queryTUserUsign(uSign);
        }
        return tuser.getuId();
        //=TUserDao.queryTUserUsign(Usign);
        //TODO用户操作

    }

}
